import {createRouter, createWebHashHistory} from "vue-router";

const routes = [
    {
        path: '/',
        component: () => import('../components/NavigationBar.vue'),
        children:[
            {
                path: '/',
                name: 'home',
                component: () => import('../components/home/allHome.vue'),
            },
            {
                path: '/contest',
                name: 'contest',
                component: () => import('../components/contest/allContest.vue'),
            },
            {
                path: '/rate',
                name: 'rate',
                component: () => import('../components/rate/allRate.vue'),
            },
            {
                path: '/user',
                name: 'user',
                component: () => import('../components/user/allUser.vue'),
            },
            {
                path: '/detail',
                name: 'detail',
                component: () => import('../components/detailOfContest/detailOfContest.vue'),
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: () => import('../components/login/allLogin.vue'),
        children: [
            {
                path: '/repwd',
                name: 'reset-password',
                component: () => import('../components/login/reSetPwd.vue'),
            },
            {
                path: '/login',
                name: 'login',
                component: () => import('../components/login/toLogin.vue'),
            },
            {
                path: '/signup',
                name: 'signup',
                component: () => import('../components/login/signUp.vue'),
            }
        ]
    },
    {
        path: '/admin',
        name: 'admin',
        component: () => import('../components/admin/adminNavigation.vue'),
        children: [
            {
                path: '/admin/user',
                name: 'adminUser',
                component: () => import('../components/admin/adminUser.vue'),
            },
            {
                path: '/admin/area',
                name: 'adminArea',
                component: () => import('../components/admin/adminArea.vue'),
            },
            {
                path: '/admin/contest',
                name: 'adminContest',
                component: () => import('../components/admin/adminContest.vue'),
            },
            {
                path: '/admin/result',
                name: 'adminResult',
                component: () => import('../components/admin/adminResult.vue'),
            },
            {
                path: '/admin/registration',
                name: 'adminRegistration',
                component: () => import('../components/admin/adminRegistration.vue'),
            }
        ]
    }
]

const router = createRouter({
    history : createWebHashHistory(),
    routes //简写 原为 routes  : routes
})

export default router